<script lang="ts" setup>
import { Search } from '@element-plus/icons-vue'
import type {KeyValue,NumOrString} from '~/types/index'
let searchTypes = ref<Array<KeyValue>>([
    { label: '查注册', value: '/register.html' },
    // { label: '查抢注', value: '/search?type=grab' },
    // { label: '查竞价', value: '/search?type=auction' },
    { label: '查一口价', value: '/once.html' },
]);
let currentType = ref<NumOrString>(1);
let appendType=ref<Array<KeyValue>>([
  {label:'.com',value:1},
  {label:'.net',value:2},
  {label:'.cn',value:3},
  {label:'.com.cn',value:4},
  {label:'.net.cn',value:5},
  {label:'.org.cn',value:6},
]);
let currentAppendType=ref<NumOrString>('');

let typePrice=ref<Array<KeyValue>>([
  {label:'.com',value:1,price:71},
  {label:'.net',value:2,price:40},
  {label:'.cn',value:3,price:39},
  {label:'.icu',value:4,price:20},
  {label:'价格总览',value:'',price:0},
]);
let currentTypePrice=ref<NumOrString>('');
let actionType=ref<Array<KeyValue>>([
  {label:'批量注册',value:1,},
  {label:'域名转入',value:2,},
  {label:'委托购买',value:3,},]);
const domain=ref('');
</script>
<template>
    <div class="domain">
        <div class="top">
            <div class="domain-left">
                <div class="text-3xl font-bold"><span class="text-[var(--el-color-success)]">1000</span>0000 <span class="text-xl font-normal">+用户</span></div>
                <div class="text-sm">选择在蓝名网注册域名</div>
                <div class="url">lanming.cc</div>
            </div>
            <div>
                <div class="flex justify-between">
                    <div class="search-type">
                        <NuxtLink v-for="(item,ind) in searchTypes" :to="item.value"><span  :key="item.value"  class="type-item hover:active" :class="{active:!ind}">{{ item.label }}</span></NuxtLink>
                    </div>
                    <div class="one-price">
                      <NuxtLink to="/once">
                        <span class="icon">&#xe6aa;</span>
                        <span class="ml-1">域名一口价市场，海量域名任你挑选！</span>
                      </NuxtLink>
                    </div>
                </div>
                <div class="domain-input">
                    <div style="display:grid;grid-template-columns:1fr 130px">
                        <el-input placeholder="请输入您要注册的域名或者品牌名，ID75***2 刚刚注册了 hr***wh.com" class="domain-search-input" v-model="domain">
                          <template #prepend>
                            <el-button :icon="Search" style="border:none;color:var(--el-color-primary);background-color:var(--el-color-white)" />
                          </template>
                            <template #append>
                                <el-select v-model="currentAppendType" placeholder="后缀" class="custom-select">
                                  <el-option
                                      v-for="item in appendType"
                                      :key="item.label"
                                      :label="item.label"
                                      :value="item.label"
                                  />
                                </el-select>
                            </template>    
                        </el-input>
                        <el-button type="primary" style="height:46px;margin-top:14px;border:1px solid var(--el-color-primary);border-radius:0;"><NuxtLink :to="`/register?domain=${domain}&suffix=${currentAppendType}`">查域名</NuxtLink></el-button>
                    </div>
                </div>
<!--                <div class="flex justify-between">-->
<!--                  <div class="flex">-->
<!--                    <div class="domain-price-item split" v-for="item in typePrice">-->
<!--                      <span class="text-xs">{{item.label}}</span>-->
<!--                      <span class="text-sm px-1" v-if="item.extent">¥{{item.extent}}</span>-->
<!--                    </div>-->
<!--                    <div class="domain-price-item active">-->
<!--                      <span class="text-xs">优惠活动</span>-->
<!--                    </div>-->
<!--                  </div>-->
<!--                  <div class="flex">-->
<!--                    <div class="action" :class="[actionType.length!=index+1?'split':'pl-2.5']" v-for="(item,index) in actionType"><span class="text-xs">{{item.label}}</span></div>-->
<!--                  </div>-->
<!--                </div>-->
            </div>
        </div>
<!--        <div class="domain-order">-->
<!--          <div class="box">-->
<!--            <div class="flex justify-between p-5 box-header">-->
<!--              <div class="text-sm box-title">热门抢注域名</div>-->
<!--              <div class="text-xs hover:text-[var(&#45;&#45;el-color-primary)]">今日有 <span class="text-[var(&#45;&#45;el-color-primary)]">160311</span> 个域名即将被删除 <span class="icon">&#xe6be;</span></div>-->
<!--            </div>-->
<!--            <div class="box-list">-->
<!--              <div v-for="item in 16" class="box-list-item">-->
<!--                <span>baidu.com{{item+1}}</span>-->
<!--                <img src="~/assets/imgs/hot-j.png" alt="" v-if="item%2" class="follow" />-->
<!--              </div>-->
<!--            </div>-->
<!--          </div>-->
<!--          <div class="box">-->
<!--            <div class="flex justify-between p-5 box-header">-->
<!--              <div class="text-sm box-title">热门竞价域名</div>-->
<!--              <div class="text-xs hover:text-[var(&#45;&#45;el-color-primary)]">今日有 <span class="text-[var(&#45;&#45;el-color-primary)]">160311</span> 个域名即将被结拍 <span class="icon">&#xe6be;</span></div>-->
<!--            </div>-->
<!--            <div class="box-list type2">-->
<!--              <div v-for="item in 6" class="box-list-item">-->
<!--                <div>-->
<!--                  <div class="flex">-->
<!--                    <span>lanming.cc{{item+1}}</span>-->
<!--                    <img src="~/assets/imgs/hot-j.png" alt="" v-if="item%2" class="follow" />-->
<!--                  </div>-->
<!--                  <div class="box-list-price">-->
<!--                    &#8776; 470-->
<!--                  </div>-->
<!--                  <div class="box-list-time">-->
<!--                    剩余时间：1天5小时55分-->
<!--                  </div>-->
<!--                </div>-->


<!--              </div>-->
<!--            </div>-->
<!--          </div>-->
<!--        </div>-->
    </div>
</template>
<style lang="scss" scoped>
.domain {
  position: relative;
  z-index: 1;
  width: 1160px;
  padding: 28px 20px 20px;
  box-sizing: border-box;
  margin: 0 auto;
  //margin-top: -430px;
  box-shadow: 0px 6px 25px 0px rgba(195, 199, 203, 0.3);
  background: -webkit-linear-gradient(bottom ,#dbecfd,#fff 25%);
  background: -moz-linear-gradient(bottom ,#dbecfd,#fff 25%);
  background: -o-linear-gradient(bottom ,#dbecfd,#fff 25%);
  background: linear-gradient(to bottom ,#dbecfd,#fff 25%);
  filter: progid:DXImageTransform.Microsoft.gradient(GradientType=0, startColorstr=#dbecfd, endColorstr=#ffffff);
  -ms-filter: "progid:DXImageTransform.Microsoft.gradient (GradientType=0, startColorstr=#dbecfd, endColorstr=#ffffff)";
}
.domain-left{
    color:var(--el-color-primary);
    text-align: center;
    padding-top:10px;
}
.top{
    height: 110px;
    display: grid;
    grid-template-columns: 214px 1fr;
    grid-gap:0 20px;
}
.url{
    position: relative;
    &::after{
        content: '';
        position: absolute;
        left: 0;
        top: 12px;
        width: 50px;
        height: 1px;
        background: var(--el-color-primary);
    }
    &::before{
        content: '';
        position: absolute;
        right:0;
        top: 12px;
        width: 50px;
        height: 1px;
        background: var(--el-color-primary);
    }
}
.domain-right{
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    margin-bottom: 20px;
    }
.type-item{
    display: inline-block;
    position:relative;
    border-left: 4px;
    padding: 0 10px;
    color: black;
    font-size: 14px;
    cursor: pointer;
    &::after{
        position:absolute;
        content: '';
        right: 0;
        width:1px;
        height: 10px;
        top:6px;
        background-color: var(--el-color-black);
    }
    &:last-child::after{
        display: none;
    }
    &:hover{
        color: var(--el-color-primary);
    }
    &.active{
        color: var(--el-color-primary);
    }
}    
.one-price{
    font-size:12px;
    color:var(--el-color-primary);
    padding-right: 10px;
    background: url(~/assets/imgs/more_icon.png) no-repeat right 3px;
    background-size: 6px;
}
.domain-search-input{
  :deep(.el-input-group__prepend) ,:deep(.el-input-group__append){
    background-color: var(--el-color-white);
    border:none;
  }
  border:1px solid var(--el-color-primary-light-3);
  height:46px;
  line-height: 46px;
  margin:14px 0;
  background-color: var(--el-color-white);
}
.custom-select{
  width:120px;
  text-align:center;
  :deep(.el-select__wrapper){
    box-shadow:none!important;
  }
  :deep(.el-select__placeholder){
    text-align: center;
    color:var();
  }
}
.domain-price-item.active{
    position: relative;
    padding:0 28px;
    &::before{
      position: absolute;
      content:'';
      width:14px;
      height: 14px;
      background-image:url(~/assets/imgs/icon-lp.png);
      background-size: 100% 100%;
      left: 10px;
      top:5px;
    }
  &::after{
    position: absolute;
    content:'';
    width:28px;
    height: 13px;
    background-image:url(~/assets/imgs/icon-new.png);
    background-size: 100% 100%;
    right: -2px;
    top:-2px;
  }
}
.split{
  position: relative;
  padding: 0 10px;
  &::after {
    position: absolute;
    content: "";
    top: 7px;
    right: 0;
    width: 1px;
    height: 12px;
    background-color: var(--el-color-black);
  }
}
.domain-order{
  display: grid;
  grid-template-columns: repeat(2,1fr);
  grid-column-gap: 14px;
}
$box-border:1px solid #eeeeee;
.box{
  border:$box-border ;
  border-right: none;
  background-color: #F8F9FB;
}
.box-header{
  border-right: $box-border;
}
.box-title{
  border-left: 4px solid var(--el-color-primary-dark-2);
  padding-left: 10px;
}
.box-list{
  &.type2{
    grid-template-rows: repeat(2,109px);
    grid-template-columns: repeat(3,1fr);
    .box-list-item{
      line-height:26px;
      flex-flow: column;
      justify-content: flex-start;
      text-align: left;
      padding: 20px;
      .follow{
        margin-top: 5px;
      }
      .box-list-price{
        font-size: 14px;
        color:#ff6b22;
      }
      .box-list-time{
        font-size: 12px;
        color:#828897;
      }
    }
  }
  display: grid;
  grid-template-columns: repeat(4,1fr);
  grid-template-rows: repeat(4,53px);
}

.box-list-item{
  border-top: $box-border;
  border-right: $box-border;
  border-collapse: collapse;
  text-align: center;
  line-height: 53px;
  display: flex;
  justify-content: center;
  align-content: center;
  color:var(--el-color-primary);
  .follow{
    width:15px;
    height: 15px;
    margin-left: 4px;
    margin-top:18px;
  }
  &:hover{
    color:var(--el-color-primary-dark-2);
    background-color:var(--el-color-white);
  }
}
</style>    